module.exports = validator => {
	return (req, res, next) => {
		const { error, value } = validator(req.body);
		if (error) {
      console.log("校验失败");
			return res.status(400).json({
				code: 400,
				value: error._original,
				msg: error.details[0].message
			});
		}
    console.log("校验通过");
		req.validValue = value;
		next();
	};
};
